﻿@model IEnumerable<Ingenuity.Web.Models.MaterialInfo>

@{
    ViewData["Title"] = "物料清单";
}

<h2>物料清单</h2>
<table class="table">
    <thead>
        <tr>
            <th>零件名称</th>
            <th>材料名称</th>
            <th>使用数量</th>
            <th>创建日期</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.OrderName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.MaterialName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.UseCount)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreateDate)
                </td>
                <td>
                    @if (item.CompleteStatus == (int)CompleteStatusEnum.加工完成)
                    {
                        <label style="color:red;font-weight:bold;">加工完成</label>
                    }
                    else
                    {
                        <a href="@Url.Action("UpdateMaterialBill",new { materialInfoId=item.Id})">编辑</a>
                        <a href="@Url.Action("DeleteMaterialBill",new { materialInfoId=item.Id})">删除</a>
                        @if (item.CompleteStatus == (int)CompleteStatusEnum.待加工)
                        {
                            <a href="@Url.Action("CreateProcessInfo", "WorkSchedule", new { materialInfoId = item.Id })">配置工序</a>
                        }
                    }
                </td>
            </tr>
        }
        @if (Model == null || Model.Count() == 0)
        {
            <tr>
                <td class="text-center" colspan="5"><label style="color:red;font-weight:bold;">暂无数据！</label></td>
            </tr>
        }
    </tbody>
</table>
